@echo off
:: =================================
::	OfficeActivateLnk.bat 2024-11-03
::	Create Office Activate lnk
::	ActLnkEndCmd
:: =================================

rem ====----	ActLnkEndCmd
if "%~1"=="" (
	set "ActLnkEndCmd=k"
) else (
	set "ActLnkEndCmd=%~1"
)

if "%~2"=="" (
	set "ActLnkAuto="
) else (
	set "ActLnkAuto=%~2"
)

rem ====	基本系統設定 set 一定要加""避免空白
set "Driver=%~d0"
set "FilePath=%~p0"
set "ConfFile=%~n0"
set "FullPath=%~dp0"
set "FullPathFile=%~f0"

rem ====----	IsAdmin
call :IsAdmin

cd /D "%Driver%%FilePath%"
rem ==--

call DownloadOfficeCmd.bat ini lnk %ActLnkEndCmd% %ActLnkAuto%

goto End

:IsAdmin
	reg.exe query "HKU\S-1-5-19\Environment" >nul
	if not %ERRORLEVEL% EQU 0 (
		echo 必須「以系統管理員身分執行」
		echo You must have administrator rights to continue ...
		pause & exit
	)
	exit /b

:End
	%ComSpec% /%ActLnkEndCmd%